package org.wu.framework.authorization.platform.application;

import org.wu.framework.authorization.model.UserDetails;
import org.wu.framework.authorization.platform.application.command.CreateSysZoneInitCommand;
import org.wu.framework.authorization.platform.application.command.SysUserCommand;
import org.wu.framework.authorization.platform.domain.model.sys.menu.SysMenu;
import org.wu.framework.authorization.platform.domain.model.sys.permission.SysPermission;
import org.wu.framework.authorization.platform.domain.model.sys.user.SysUser;
import org.wu.framework.authorization.platform.domain.model.sys.zone.SysZone;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication;

import java.util.List;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyApplication
 **/

public interface SysUserApplication {


    /**
     * describe 新增
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    Result<SysUser> save(SysUserCommand sysUserCommand);

    /**
     * describe 更新
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    Result<SysUser> update(SysUserCommand sysUserCommand);

    /**
     * describe 查询单个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    Result<SysUser> findOne(SysUserCommand sysUserCommand);

    /**
     * describe 查询多个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    Result<List<SysUser>> findList(SysUserCommand sysUserCommand);

    /**
     * describe 分页查询多个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/21 11:16 晚上
     **/

    Result<LazyPage<SysUser>> findPage(int size, int current, SysUserCommand sysUserCommand);

    /**
     * describe 删除
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    Result<SysUser> delete(SysUserCommand sysUserCommand);

    /**
     * 查询用户菜单
     *
     * @param module      用户模块
     * @param userDetails 用户信息
     * @return Result<List < SysMenu>>
     */
    Result<List<SysMenu>> findUserMenuList(String module, UserDetails userDetails);

    /**
     * 获取用户区域
     *
     * @param userId 用户ID
     * @return
     */
    Result<List<SysZone>> findUseZoneList(Long userId);


    /**
     * 新增用户区域
     *
     * @param userDetails
     * @param createSysZoneInitCommand
     * @return
     */
    Result<?> createAndInitZone(UserDetails userDetails, CreateSysZoneInitCommand createSysZoneInitCommand);


    /**
     * 获取用户权限
     * @param userId 用户ID
     * @return
     */
    Result<List<SysPermission>> findUserPermissionList(Long userId);
}